﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Configuration;
using System.Globalization;
using System.Threading;

namespace Googler
{
    public static class Program
    {
        static Configuration _ConfigurationFile;
        public static Configuration ConfigurationFile
        {
            get
            {
                if (_ConfigurationFile == null)
                    _ConfigurationFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                return _ConfigurationFile;
            }
        }
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            string culture = ConfigurationManager.AppSettings["CultureAndUICulture"];
            if (!string.IsNullOrWhiteSpace(culture))
            {
                Thread.CurrentThread.CurrentCulture = new CultureInfo(culture);
                Thread.CurrentThread.CurrentUICulture = new CultureInfo(culture);
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            if (ConfigurationFile.AppSettings.GetValue<bool>("IsFirstRun"))
            {
                Application.Run(new ConfigurationForm());
                Application.Exit();
            }
            else
                Application.Run(new Form1());
        }
    }
}
